package com.pet.system.service.impl;

import com.pet.common.utils.DateUtils;
import com.pet.system.domain.PetOrders;
import com.pet.system.mapper.PetOrdersMapper;
import com.pet.system.service.IPetOrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 订单Service业务层处理
 *
 * @author pet
 * @date 2022-10-21
 */
@Service
public class PetOrdersServiceImpl implements IPetOrdersService {
    @Autowired
    private PetOrdersMapper petOrdersMapper;

    /**
     * 查询订单
     *
     * @param id 订单主键
     * @return 订单
     */
    @Override
    public PetOrders selectPetOrdersById(Long id) {
        return petOrdersMapper.selectPetOrdersById(id);
    }

    /**
     * 查询订单列表
     *
     * @param petOrders 订单
     * @return 订单
     */
    @Override
    public List<PetOrders> selectPetOrdersList(PetOrders petOrders) {
        return petOrdersMapper.selectPetOrdersList(petOrders);
    }

    /**
     * 新增订单
     *
     * @param petOrders 订单
     * @return 结果
     */
    @Override
    public int insertPetOrders(PetOrders petOrders) {
        petOrders.setCreateTime(DateUtils.getNowDate());
        return petOrdersMapper.insertPetOrders(petOrders);
    }

    /**
     * 修改订单
     *
     * @param petOrders 订单
     * @return 结果
     */
    @Override
    public int updatePetOrders(PetOrders petOrders) {
        return petOrdersMapper.updatePetOrders(petOrders);
    }

    /**
     * 批量删除订单
     *
     * @param ids 需要删除的订单主键
     * @return 结果
     */
    @Override
    public int deletePetOrdersByIds(Long[] ids) {
        return petOrdersMapper.deletePetOrdersByIds(ids);
    }

    /**
     * 删除订单信息
     *
     * @param id 订单主键
     * @return 结果
     */
    @Override
    public int deletePetOrdersById(Long id) {
        return petOrdersMapper.deletePetOrdersById(id);
    }
}
